package com.cjw.config;

//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

//@EnableWebSecurity
//public class SecurityConfig extends WebSecurityConfigurerAdapter {

//    //授权
//    @Override
//    protected void configure(HttpSecurity http) throws Exception {
//        http.authorizeRequests()
//                .antMatchers("/","login","/register").permitAll()
//                .antMatchers("/user/**").hasRole("客户")
//                .antMatchers("/admin/**").hasRole("管理员")
//                .and()
//                .csrf().disable()//关闭csrf
//                .formLogin().loginPage("/login")
//                .usernameParameter("userName").passwordParameter("passwd")
//                .defaultSuccessUrl("/index");
//        http.logout().logoutSuccessUrl("/");
//        http.formLogin().loginProcessingUrl("/login").permitAll();
//        http.rememberMe();
//
//    }
//    // 认证
//
//    @Override
//    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
//        auth.inMemoryAuthentication().passwordEncoder(new BCryptPasswordEncoder())
//                .withUser();
//    }
//}
